package com.huirui.server.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 用户表
 *
 * @TableName t_user
 */
@TableName(value = "t_user")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class User implements Serializable {
    /**
     * 用户ID，自增主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 微信用户唯一标识，小程序登录获取
     */
    @TableField(value = "openid")
    private String openid;

    /**
     * 用户昵称
     */
    @TableField(value = "nickname")
    private String nickname;

    /**
     * 用户头像URL
     */
    @TableField(value = "avatar_url")
    private String avatarUrl;

    /**
     * 用户手机号，需用户授权
     */
    @TableField(value = "phone")
    private String phone;

    /**
     * 生日
     */
    @TableField(value = "birthday")
    private LocalDate birthday;

    /**
     * 邮箱
     */
    @TableField(value = "email")
    private String email;

    /**
     * 注册时间
     */
    @TableField(value = "register_time")
    private LocalDateTime registerTime;

    /**
     * 最后登录时间
     */
    @TableField(value = "last_login_time")
    private LocalDateTime lastLoginTime;

    /**
     * 登录次数
     */
    @TableField(value = "login_count")
    private Integer loginCount;

    /**
     * 状态：0-禁用，1-正常
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 用户性别（-1-未知，1-男，0-女）
     */
    @TableField(value = "gender")
    private Integer gender;

    /**
     * 账户余额
     */
    @TableField(value = "balance")
    private BigDecimal balance;

    /**
     * 已消费金额
     */
    @TableField(value = "consumption_amount")
    private BigDecimal consumptionAmount;

    @Serial
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}